package train48days;

import java.util.Scanner;

public class 计算某字符出现的次数 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine().toLowerCase();
        String c = sc.nextLine().toLowerCase();
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i)==c.charAt(0)){
                count++;
            }
        }
        System.out.println(count);
    }
}
